    #include<stdio.h>
          
    int insert()
    {
    int list[10];
    int back,i,N,loc,Val;
    printf("\n Enter the value to be inserted and its location:");
    scanf("%d%d",&Val,&loc);
    if (loc<N)
    {
    back=N+1;
    while(back>loc)
    {
    list[back]=list[back-1];
    back--;
    }
    list[loc]=Val;
    N++;
    printf("The new list is...");
    for(i=0;i<N;i++)
    printf("%d",list[i]);
    }
    else
    printf("\n The insertion not allowed");
    }

int sort()

{
	int list[10],small, pos,N, i,j,temp;
	printf ("\n Enter the size of the list :");
	scanf ("%d", & N);
	printf ("\n Enter the list : ");
	for ( i = 0; i < N; i++)
	{
		printf ("\n Enter Number :");
		scanf ("%d", &list[i]);

	}
     
	for (i = 0;i < N - 1 ; i++)
	{
		small = list[i];
		pos = i;
    
		for ( j = i+1; j<N; j++)
		{
			if (small > list [j])
				{
					small = list [j];
					pos = j;

				}

		}
		temp = list [i];
		list[i]= list [pos];
		list[pos]= temp;
	
	}
	printf ("The Sorted list...");
		for ( i = 0; i < N; i++)
		printf ( "%d", list[i]);

}

int append()

{	
	int i,list[10],N,Val;

	printf("Enter the size of the array");
	scanf("%d",&N);
	
	printf("Enter the array elements:");
	for (i=0;i<N;i++)
	{	printf("Enter the element %d of  the array:",i+1);
        	scanf("%d",&list[i]);
    	}
	
	printf("Enter the value to be inserted:");
	scanf("%d",&Val);

		list[N+1]=Val;
		N++;

	printf("The new list is...");
		for(i=0;i<N;i++)
		printf("%d",list[i]);
}

int index()

{	int i,list[10],N,Val;

	printf("Enter the size of the array");
	scanf("%d",&N);
	
	printf("Enter the array elements:");
	for (i=0;i<N;i++)
	{	printf("Enter the element %d of  the array:",i+1);
        	scanf("%d",&list[i]);
    	}
	
	printf("Enter the value whose index is to find :");
	scanf("%d",&Val);
	
	for (i=0;i<N;i++)
	{	if(list[i]==Val)
		{	printf("The value is found at %d position",i);
			break;
		}
		else
			printf("The value %d is not found!!!",Val);
	}
}

int remove()
{	int i,j,list[10],N,Val;

	printf("Enter the size of the array");
	scanf("%d",&N);
	
	printf("Enter the array elements:");
	for (i=0;i<N;i++)
	{	printf("Enter the element %d of  the array:",i+1);
        	scanf("%d",&list[i]);
    	}
	
	printf("Enter the value to be removed:");
	scanf("%d",&Val);
	for(i=0;i<N;i++)
	{	if (list[i]==Val)
		{	for(j=i;j<N-1;j++)
			list[j]=list[j+1];
			list[N-1]="\0";
		}
		else
			printf("The number you entered is not in list!!!");
	}			
}
    main()
    {
    int c;

    printf("The menu for array operations is as follows :");
    printf("1.Append:");
    printf("2.Extend:");
    printf("3.Insert:");
    printf("4.Remove:");
    printf("5.Pop:");
    printf("6.Index:");
    printf("7.Count:");
    printf("8.Sort:");
    printf("9.Reverse:");

    printf("Enter your choice(1-9)");
    scanf("%d",&c);
    switch(c)
    {    case(1):append();
            break;
        case(2):extend();
            break;
        case(3):insert();
            break;
        case(4):remove();
            break;
        case(5):pop();
            break;
        case(6):index();
            break;
        case(7):count();
            break;
        case(8):sort();
            break;
        case(9):reverse();
            break;

        default:printf("Please enter your choice again(1-6),,,!!!,,,,INVALID CHOICE!!!!!!:");
    }
 }
